The idea of video compression is to omit certain data of an image that are imperceptible to human's eyes, i.e. so-called visual redundancy. The data to be omitted are generally similar to other data in space or time dimension, and thus can be removed according to a compression algorithm. H.264/AVC is one of the mainstream standards of video compression. Compared to conventional digital video compression standards, such as MPEG-2, MPEG-4 or H.263, H.264 exhibits higher compression performance, and nevertheless reaches better image quality under the same compression ratio.
The coding mechanism of H.264/AVC compression is block-based. In brief, an image frame is divided into a plurality of rectangular areas called as macroblocks (MB). The macroblocks are then encoded. First, intra-frame prediction and inter-frame prediction techniques are used to remove the similarities between images so as to obtain the residual differences. Then the residual differences are spatially transformed and quantized to remove the visual redundancy.
An important factor of the high compression efficiency in H.364/AVC is the utilization of context adaptive binary arithmetic coding (CABAC). Please refer to FIG. 1A, in which the operation of a CABAC decoder is briefly illustrated. For CABAC decoding, the decoder 10 executes a decoding operation for each block to generate a corresponding coded_block_flag parameter. The coded_block_flag parameter indicates whether a given block contains any non-zero residual difference or not. If there is no residual difference, the coded_block_flag parameter is set to “0” for the given block. Otherwise, the coded_block_flag parameter is set to “1” if there exists non-zero residual difference in the given block.
The decoding operation of the decoder 10 is based on a context ID which includes a base portion and an offset portion. The base portion can be obtained by a lookup table, but the offset portion is calculated from the coded_block_flag. Therefore, a key point to calculate the coded_block_flag parameter is to obtain corresponding offset portion. For calculating the offset operation, the coded_block_flag parameters of neighboring left and top blocks next to the target block have to be determined in advance. For example, as illustrated in FIG. 1B, an image frame 11 encoded in H.264 is divided into a plurality of macroblocks 12, and each of the macroblock 12 is further divided into a plurality of blocks 13, e.g. M×N blocks K11˜Kmn. For example, M=N=4 as illustrated in FIG. 1C shows the macroblock 12 is divided into 16 blocks labeled as 0˜15 and each of the blocks 0˜15 includes 4×4 pixels. The offset value of each block 13 is calculated according to coded_block_flag parameters of the neighboring left and top blocks of the current block.
Due to the reason that characteristics of neighboring left or top blocks of each block may be different (e.g. size of each, inter or intra macroblock), H.264 utilizes a universal algorithm for calculating the offset value of all blocks. This would result in huge and complex computation since every block demands repeated processing. Consequently, hardware resource is occupied and causes large consumption of time. It can be realized that there exists a need to solve such deficiency.